﻿using System;
using System.Collections.Generic;
using System.Text;

namespace MicroMq.Core
{
    /// <summary>
    /// 任务调度
    /// </summary>
    [AttributeUsage(AttributeTargets.Method)]
    public class DispatcherAttribute : Attribute
    {
        public readonly string TaskName;
        public readonly string CronExpression;
        /// <summary>
        /// 按 cron 表达式调度任务 (秒 分 时 天 月 周 年)
        /// </summary>
        /// <param name="cronExpression">cron 表达式</param>
        public DispatcherAttribute(string cronExpression) : this(null, cronExpression)
        {

        }
        /// <summary>
        /// 按 cron 表达式调度任务
        /// </summary>
        /// <param name="taskName">任务名称</param>
        /// <param name="cronExpression">cron 表达式</param>
        public DispatcherAttribute(string taskName, string cronExpression)
        {
            TaskName = taskName;
            CronExpression = cronExpression;
        }
    }
}
